<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>管理后台</title>
<link rel="stylesheet" type="text/css" href="{$Think.__PUBLIC__}css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="{$Think.__PUBLIC__}css/style.css">
<link rel="stylesheet" type="text/css" href="{$Think.__PUBLIC__}css/login.css">
<script src="{$Think.__PUBLIC__}js/jquery-2.1.4.min.js"></script>
<!--[if gte IE 9]>
  <script src="{$Think.__PUBLIC__}js/jquery-1.11.1.min.js" type="text/javascript"></script>
  <script src="{$Think.__PUBLIC__}js/html5shiv.min.js" type="text/javascript"></script>
  <script src="{$Think.__PUBLIC__}js/respond.min.js" type="text/javascript"></script>
  <script src="{$Think.__PUBLIC__}js/selectivizr-min.js" type="text/javascript"></script>
<![endif]-->
<!--[if lt IE 9]>
  <script>window.location.href='upgrade-browser.html';</script>
<![endif]-->
</head>

<body class="user-select">
<div class="container">
  <!--<div class="siteIcon"><img src="{$Think.__PUBLIC__}images/icon/logo.jpg" alt="" data-toggle="tooltip" data-placement="top" title="欢迎来到大象拼车后台管理系统登录处" draggable="false" /></div>-->
  <div class="form-signin">
    <h2 class="form-signin-heading">管理员登录</h2>
    <label for="userName" class="sr-only">用户名</label>
    <input type="text" id="userName" name="username" class="form-control" placeholder="请输入用户名" required autofocus autocomplete="off" maxlength="10">
    <label for="userPwd" class="sr-only">密码</label>
    <input type="password" id="userPwd" name="password" class="form-control" placeholder="请输入密码" required autocomplete="off" maxlength="18">
    <button class="btn btn-lg btn-primary btn-block" id="signinSubmit">登录</button>
  </div>
  <div class="footer">
  </div>
</div>

<script src="{$Think.__PUBLIC__}js/bootstrap.min.js"></script>
<script>
//$('[data-toggle="tooltip"]').tooltip();
//window.oncontextmenu = function(){
//	//return false;
//};
$('.siteIcon img').click(function(){
	window.location.reload();
});
$('#signinSubmit').click(function(){
	if($('#userName').val() === ''){
		$(this).text('用户名不能为空');
	}else if($('#userPwd').val() === ''){
		$(this).text('密码不能为空');
	}else{
		$(this).text('请稍后...');
        user = $("#userName").val();
        pass = $("#userPwd").val();
        $.ajax({
            type: "POST",
            url: "{:url('index/login/login')}",
            data: {"username": user, "password": pass},
            cache: false, //不缓存此页面
            success: function (data) {
                if (data == 1) {
                    $(this).text('登陆成功...');
                    self.location="{:url('index/index/index')}";
//                    history.go(0);
                }else if (data == -2){
                    alert("该用户不存在");
                }else if (data == -3){
                    alert("密码错误");
                }
            }
        });
	}
});
</script>
</body>
</html>
